<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
 '
 ' Copyright 2007 Liu, Xiaokang <4341322@gmail.com>
 ' Blog <http://www.ioio.name/>
 ' 
 ' This file is part of JOS(Judge Online System).
 ' You can see this project at <http://code.google.com/p/judgeonline/>
 ' 
 ' JOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
 ' published by the Free Software Foundation; either revision 3 of the License, or (at your option) any later revision.
 ' 
 ' JOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 ' 
 ' You should have received a copy of the GNU General Public License along with JOS. if not, see
 ' <http://www.gnu.org/licenses/>.
 '
%>
<%Option Explicit%>
<%
	Dim PageTitle
  PageTitle="Print"
%>
<!--#include file="Header.asp"-->
<style type="text/css" media="print">
#Header,#Footer,#Print_Button{
	display:none;
}
</style>
<div id="Main">
  <div class="CodeViewx" align="center">
  <div style="width:80%; background-color:#F4FBFF;">
     <% 
   Dim PrintId
   If Not isempty(Request("Pid")) Then
      PrintId=Clng(Request("Pid"))
	  PrintId=CStr(PrintId)
   
   Dim Sr
   conn.Open connstr
   Set Sr = Server.CreateObject("ADODB.Recordset")
   Sr.Open "SELECT [C_P_Id],[Uid],[Cid],[Contents],[SubmitTime],[PrintedTime],[Printed] From [Contest_Print] Where C_P_Id="+ PrintId ,conn,1,3 
   
   If  Sr.eof Or Sr.Bof then
   Response.Write "Permission Denied."
   Else
   If Request.Cookies(CookiesName)("Permission")<3 and Request.Cookies(CookiesName)("Permission") Then
   	If Not Sr("Printed") Then
	Sr("Printed")= True	
	Sr("PrintedTime")= Now()
	Sr.Update
	End If
	%>
    <script type=text/javascript src="Scripts/utility.js"></script>
	<script type=text/javascript src="Scripts/cpp_coderender.js"></script>
	<script type=text/javascript src="Scripts/java_coderender.js"></script>

<div align=center style="font-family:Arial;border-bottom:#B7CBFF 1px dashed;padding:6px"><b><font color=green>Contests : <a href='Contest_Details.asp?Cid=<%=Sr("Cid")%>' target=_blank><%=Sr("Cid")%></a> &nbsp;&nbsp;&nbsp;&nbsp;Author :<%=Sr("Uid")%>
<br>PrintId : <%=Sr("C_P_Id")%>&nbsp;&nbsp;SubmitTime : <%=Sr("SubmitTime")%>&nbsp;&nbsp;PrintedTime : <%=Sr("PrintedTime")%>&nbsp;&nbsp;Printed : <%=Sr("Printed")%></div>

<textarea id=usercode style="display:none;text-align:left;"><%=Sr("Contents")%></textarea>
<div style="padding:10px"><pre style="font-family:Courier New;text-align:left;">
<script language=javascript>document.write(renderCode(document.getElementById('usercode').value));</script>
</pre></div>
<div id="Print_Button" style="font-size:12px;font-weight:bold;" align=center><a href="javascript:window.history.go(-1)" onclick="window.print();">[ Print ]</a><br><br></div>

  <%Else
	Response.Write "Permission Denied."
	End If
	End If
	Sr.Close
	Set Sr=nothing
    End If
	conn.Close
   %>   
  </div>
  </div>
</div>
<!--#include file="Footer.asp"-->